home *** CD-ROM | disk | FTP | other *** search
/ Sprite 1984 - 1993 / Sprite 1984 - 1993.iso / src / cmds / rawstat / RCS / rawmig.c,v < prev    next >
Encoding:
Text File  |  1990-09-24  |  5.4 KB  |  184 lines

  1. head     1.2;
  2. branch   ;
  3. access   ;
  4. symbols  ;
  5. locks    ; strict;
  6. comment  @ * @;
  7.  
  8.  
  9. 1.2
  10. date     90.09.24.14.40.32;  author douglis;  state Exp;
  11. branches ;
  12. next     1.1;
  13.  
  14. 1.1
  15. date     90.05.01.16.50.43;  author douglis;  state Exp;
  16. branches ;
  17. next     ;
  18.  
  19.  
  20. desc
  21. @stats for migration daemon.
  22. @
  23.  
  24.  
  25. 1.2
  26. log
  27. @changes for migration stats
  28. @
  29. text
  30. @/* 
  31.  * rawmig.c --
  32.  *
  33.  *    Print raw format MIGRATION statistics.
  34.  *
  35.  * Copyright (C) 1990 Regents of the University of California
  36.  * Permission to use, copy, modify, and distribute this
  37.  * software and its documentation for any purpose and without
  38.  * fee is hereby granted, provided that the above copyright
  39.  * notice appear in all copies.  The University of California
  40.  * makes no representations about the suitability of this
  41.  * software for any purpose.  It is provided "as is" without
  42.  * express or implied warranty.
  43.  */
  44.  
  45. #ifndef lint
  46. static char rcsid[] = "$Header: /sprite/src/cmds/rawstat/RCS/rawmig.c,v 1.1 90/05/01 16:50:43 douglis Exp Locker: douglis $ SPRITE (Berkeley)";
  47. #endif /* not lint */
  48.  
  49. #include "sprite.h"
  50. #include "stdio.h"
  51. #include "mig.h"
  52.  
  53.  
  54. /*
  55.  *----------------------------------------------------------------------
  56.  *
  57.  * PrintRawMigStat --
  58.  *
  59.  *    Prints Mig_Stats structure maintained by migration daemon.
  60.  *
  61.  * Results:
  62.  *    None.
  63.  *
  64.  * Side effects:
  65.  *    Opens connection to daemon.
  66.  *
  67.  *----------------------------------------------------------------------
  68.  */
  69.  
  70. PrintRawMigStat()
  71. {
  72.     Mig_Stats stats;        /* statistics buffer */
  73.     Mig_Stats *X = &stats;
  74.     Mig_ArchStats *A;
  75.     int status;
  76.     int i;
  77.     int j;
  78.     double overflowFactor;
  79.  
  80.     if (Mig_GetStats(&stats) < 0) {
  81.     return;
  82.     }
  83. #ifdef MIG_STATS_VERSION
  84.     if (stats.version != MIG_STATS_VERSION) {
  85.     return;
  86.     }
  87. #endif
  88.     printf("Migration daemon stats\n");
  89.  
  90.  
  91.     ZeroPrint("version   %8u\n", X->version);
  92.     ZeroPrint("checkpointInterval        %8u\n", X->checkpointInterval);
  93.     ZeroPrint("firstRun         %8u\n", X->firstRun);
  94.     ZeroPrint("restarts        %8u\n", X->restarts);
  95.     ZeroPrint("intervals          %8u\n", X->intervals);
  96.     ZeroPrint("maxArchs        %8u\n", X->maxArchs);
  97.     ZeroPrint("getLoadRequests         %8u\n", X->getLoadRequests);
  98.     ZeroPrint("totalRequests         %8u\n", X->totalRequests);
  99.     ZeroPrint("totalObtained         %8u\n", X->totalObtained);
  100.     ZeroPrint("numRepeatRequests         %8u\n", X->numRepeatRequests);
  101.     ZeroPrint("numRepeatAssignments         %8u\n", X->numRepeatAssignments);
  102.     ZeroPrint("numFirstAssignments         %8u\n", X->numFirstAssignments);
  103.  
  104.     for (i = 0; i < X->maxArchs; i++) {
  105.     A = &X->archStats[i];
  106.     if (strcmp(A->arch, "sun4") && strcmp(A->arch, "ds3100")) {
  107.         continue;
  108.     }
  109.     printf("Migration daemon %s stats\n", A->arch);
  110.  
  111.     ZeroPrint("numClients         %8u\n", A->numClients);
  112.     ZeroPrint("gotAll         %8u\n", A->gotAll);
  113.  
  114.     for (j = 0; j <= MIG_MAX_HOSTS_DIST; j++) {
  115.         printf("request%d         %8u\n", j, A->requestDist[j]);
  116.         printf("obtained%d         %8u\n", j, A->obtainedDist[j]);
  117.     }
  118.     ZeroPrint("nonIdleTransitions         %8u\n", A->nonIdleTransitions);
  119.  
  120.     ZeroPrint("requested         %8u\n", A->counters.requested);
  121.     ZeroPrint("requested:square         %8u\n", A->squared.requested);
  122.     ZeroPrint("obtained         %8u\n", A->counters.obtained);
  123.     ZeroPrint("obtained:square         %8u\n", A->squared.obtained);
  124.     ZeroPrint("evicted         %8u\n", A->counters.evicted);
  125.     ZeroPrint("evicted:square         %8u\n", A->squared.evicted);
  126.     ZeroPrint("reclaimed         %8u\n", A->counters.reclaimed);
  127.     ZeroPrint("reclaimed:square         %8u\n", A->squared.reclaimed);
  128.     ZeroPrint("timeUsed         %8u\n", A->counters.timeUsed);
  129.     ZeroPrint("timeUsed:square         %8u\n", A->squared.timeUsed);
  130.     ZeroPrint("timeToEviction         %8u\n", A->counters.timeToEviction);
  131.     ZeroPrint("timeToEviction:square         %8u\n",
  132.           A->squared.timeToEviction);
  133.  
  134.     /*
  135.      * For "pseudo-double" variables -- two integers -- we need to store
  136.      * them in this program as real double variables.  The problem is,
  137.      * we can't just convert 0x80000000 from an unsigned int to float, because
  138.      * our C compiler goofs and makes the result negative.  Therefore, some
  139.      * tricks to take the constant and turn it into a number
  140.      * we can use to multiply by the overflow counter.  Shift it right, then
  141.      * multiply it by the equivalent number once it's a "double".  
  142.      */
  143.     overflowFactor = (((unsigned) 0x80000000) >> 1) * 2.0;
  144.     
  145. #define TO_DOUBLE(array) \
  146.     (array[MIG_COUNTER_LOW] + array[MIG_COUNTER_HIGH] * overflowFactor)
  147.  
  148.     printf("hostIdleObtained         %8.0f\n",
  149.           TO_DOUBLE(A->counters.hostIdleObtained));
  150.     printf("hostIdleObtained:square         %8.0f\n",
  151.           TO_DOUBLE(A->squared.hostIdleObtained));
  152.     printf("hostIdleEvicted         %8.0f\n",
  153.           TO_DOUBLE(A->counters.hostIdleEvicted));
  154.     printf("hostIdleEvicted:square         %8.0f\n",
  155.           TO_DOUBLE(A->squared.hostIdleEvicted));
  156.     printf("idleTimeWhenActive         %8.0f\n",
  157.           TO_DOUBLE(A->counters.idleTimeWhenActive));
  158.     printf("idleTimeWhenActive:square         %8.0f\n",
  159.           TO_DOUBLE(A->squared.idleTimeWhenActive));
  160.     
  161.     for (j = 0; j < MIG_NUM_STATES; j++) {
  162.         printf("state%d         %8u\n", j, A->counters.hostCounts[j]);
  163.         printf("state%d:square         %8u\n", j, A->squared.hostCounts[j]);
  164.     }
  165.     }
  166. }
  167.  
  168.  
  169. @
  170.  
  171.  
  172. 1.1
  173. log
  174. @Initial revision
  175. @
  176. text
  177. @d17 1
  178. a17 1
  179. static char rcsid[] = "$Header: /sprite/lib/forms/RCS/proto.c,v 1.3 90/01/12 12:03:36 douglis Exp $ SPRITE (Berkeley)";
  180. d69 5
  181. a88 1
  182.     ZeroPrint("numRepeatAssignments         %8u\n", A->numRepeatAssignments);
  183. @
  184.